/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interface;
import java.sql.Connection;
import java.util.List;
import negocio.Tabela;
import negocio.NegocioFachada;
import negocio.Coluna;

/**
 *
 * @author v3550
 */
public class Controlador {
     
    NegocioFachada controlador;
    Connection conn = null;
    static Controlador  instance = null;
    
    private Controlador()
    {
        controlador =  new NegocioFachada();
    }
    
    public static Controlador getInstance()
    {
          if(instance == null)
              instance = new Controlador();
          
          return instance;
    }
    
    public Connection setarConexao(String user, String pass, String host, String port, String sid) throws Exception {
        conn = controlador.setarConexao(user, pass, host, port, sid);
        return conn;
    }
    
    public void setConnection(Connection c){
        this.conn = c;
    }

    public List<Tabela> getTabelas(String owner) throws Exception{
        return controlador.getTabelas(owner);
    }

    public List<Coluna> getColunas(String owner, String table) throws Exception
    {
        return controlador.getColunas(owner, table);
    }
    
    public List<String> getListOwners() throws Exception
    {
        return controlador.getListaOwners();
    }
    
    public void fecharConexao() throws Exception
    {
        controlador.fecharConexao();
    }

    public boolean gravarNoDicionario(String tabela, String owner, Integer linhaInicial, float taxaCrescimento, Integer reterDados, List<Coluna> list) throws Exception {
       return controlador.gravarNoDicionario(tabela, owner, linhaInicial,taxaCrescimento, reterDados,list);
    }
   
    public Tabela recuperarDicionario(String onwer, String tabela) throws Exception
    {
       return controlador.recuperarDicionario(onwer, tabela);
    }
  
    public void calculoVolumetrico(String owner) throws Exception
    {
        controlador.calculoVolumetrico(owner);
    }
    
     
}
